<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<FiltronASP.Areas.Admin.ViewModels.Languages.LanguagesIndexViewModel>" %>
<%@ Import Namespace="FiltronASP.Helpers.HtmlTags" %>
<%@ Import Namespace="FiltronASP.Helpers.Routes" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Zarządzanie wersjami językowymi
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="right-page-buttons2">
        <% Html.RenderPartial("LanguagesListForm"); %>
    </div>              
    <table class="right-pages usertable">
	    <tbody>
	        <% if ((Model.PaginatedLanguages == null) || (Model.PaginatedLanguages.Count == 0)) { %>
                <tr class="right-row">
                    <td class="right-cell-big">Brak elementów do wyświetlenia.</td>
                </tr>
            <% } else { //if null   %>
                <% foreach (var language in Model.PaginatedLanguages) { %>
                    <% if ((Model.PaginatedLanguages.IndexOf(language) % 2) == 0) { %>
                        <tr class="right-row">
                            <td class="right-cell-big">
                                <% if (!(String.IsNullOrEmpty(language.language_img))) { %>                                   
                                    <img src="<%= Url.GenerateAdminImageLink(language.language_img) %>" alt=" " width="20" height="12"/>
                                <% } //if img %>                            
                                <%= language.language_name %>
                            </td>
                            <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>
                                    <%= Html.ActionLinkWithImage("admin-right-edit.png", " Edytuj", "Edit", new { languageId = (language.language_id), currentLanguageId = (Model.CurrentLanguage.language_id) })%>
                                <% } else {     //if %>                                   
                                    <%= Html.ActionLinkWithImage("admin-right-edit.png", " Edytuj", "Edit", new { languageId = (language.language_id)})%>
                                <% }    //else %>                                    
                            </td>                           
                            <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>
                                    <%= Html.ActionLinkWithImage("admin-right-remove.png", " Usuń", "Delete", new { languageId = (language.language_id), currentLanguageId = (Model.CurrentLanguage.language_id) })%>
                                <% } else {     //if %>                                   
                                    <%= Html.ActionLinkWithImage("admin-right-remove.png", " Usuń", "Delete", new { languageId = (language.language_id)})%>
                                <% }    //else %>                                    
                            </td>                           
                        </tr>                       
                    <% } else { //if row %>                       
                        <tr class="right-row altrow">
                            <td class="right-cell-big">
                                <% if (!(String.IsNullOrEmpty(language.language_img))) { %>   
                                    <img src="<%= Url.GenerateAdminImageLink(language.language_img) %>" alt=" " width="20" height="12"/>
                                <% } //if img %>                            
                                <%= language.language_name%>
                            </td>
                            <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>
                                    <%= Html.ActionLinkWithImage("admin-right-edit.png", " Edytuj", "Edit", new { languageId = (language.language_id), currentLanguageId = (Model.CurrentLanguage.language_id) })%>
                                <% } else {     //if %>                                   
                                    <%= Html.ActionLinkWithImage("admin-right-edit.png", " Edytuj", "Edit", new { languageId = (language.language_id)})%>
                                <% }    //else %>                                    
                            </td>                           
                            <td class="right-cell-mid">
                                <% if (Model.CurrentLanguage != null) { %>
                                    <%= Html.ActionLinkWithImage("admin-right-remove.png", " Usuń", "Delete", new { languageId = (language.language_id), currentLanguageId = (Model.CurrentLanguage.language_id) })%>
                                <% } else {     //if %>                                   
                                    <%= Html.ActionLinkWithImage("admin-right-remove.png", " Usuń", "Delete", new { languageId = (language.language_id)})%>
                                <% }    //else %>                                    
                            </td>                           
                        </tr>                       
                    <% } //else %>                                                
                <% }    //foreach %>
            <% }    //else null %>
	    </tbody>
    </table>
    <div class="right-pagination">
        <% if ((Model.PaginatedLanguages != null) && (Model.PaginatedLanguages.Count > 0)) { %>
            <% if (Model.PaginatedLanguages.HasPreviousPage) { %>
                <a href="<%= Url.GenerateLanguagesListRoute(1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-first.png")%>" alt="pierwsza" />
                </a>
                <a href="<%= Url.GenerateLanguagesListRoute(Model.PaginatedLanguages.PageIndex - 1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-prev.png")%>" alt="poprzednia" />
                </a>
            <% } //if prev %>
            <% if ((Model.PaginatedLanguages.HasPreviousPage) || (Model.PaginatedLanguages.HasNextPage)) { %>
                &nbsp;&nbsp;
                Strona <%= Model.PaginatedLanguages.PageIndex%> z <%= Model.PaginatedLanguages.PagesCount%>
                &nbsp;&nbsp;
            <% } //if %>
            <% if (Model.PaginatedLanguages.HasNextPage) { %>
                <a href="<%= Url.GenerateLanguagesListRoute(Model.PaginatedLanguages.PageIndex + 1, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-next.png")%>" alt="następna" />
                </a>
                <a href="<%= Url.GenerateLanguagesListRoute(Model.PaginatedLanguages.PagesCount, Model.CurrentLanguage) %>">
                    <img src="<%= Url.GenerateAdminImageLink("admin-right-last.png")%>" alt="ostatnia" />
                </a>
            <% } //if next %>    
        <% } //if not null and not empty %>    
    </div>    	   
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    Zarządzanie wersjami językowymi
</asp:Content>
